home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Disc to the Future 2
/
Disc to the Future Part II Programmer's Reference (Wayzata Technology)(6013)(1992).bin
/
MAC
/
THINKC
/
4_0
/
DVIM72-M
/
GET_PGTA.C
< prev
next >
Wrap
Text File
|
1990-04-14
|
2KB
|
58 lines
/**********************************************************************/
/****************************** getpgtab ******************************/
/**********************************************************************/
#include "dvihead.h"
#include "commands.h"
#include "gendefs.h"
#include "gblprocs.h"
#include "egblvars.h"
#include "m72.h"
void
getpgtab(lastpageptr)
long lastpageptr;
{
register long p;
register INT16 i,k;
(void) FSEEK (dvifp,lastpageptr,0);
p = lastpageptr;
for (k = 0; (p != (-1)) && (k < MAXPAGE); ++k)
{
page_ptr[MAXPAGE-1-k] = p;
(void) FSEEK (dvifp,(long) p, 0);
if ((BYTE)nosignex(dvifp,(BYTE)1) != BOP)
(void)fatal(
"getpgtab(): Invalid BOP (beginning-of-page) back chain");
for (i = 0; i <= 9; ++i)
(void) nosignex(dvifp,(BYTE)4); /* discard count0..count9 */
p = (long)signex(dvifp,(BYTE)4);
}
page_count = k;
if (k >= MAXPAGE)
(void)warning("getpgtab(): Page table full...rebuild driver with \
larger MAXPAGE");
else /* move pointer table to front of array */
for (k = 0; k < page_count; ++k)
page_ptr[k] = page_ptr[MAXPAGE-page_count+k];
}
/**********************************************************************/
/****************************** getbytes ******************************/
/**********************************************************************/
void
getbytes(fp, cp, n) /* get n bytes from file fp */
register FILE *fp; /* file pointer */
register char *cp; /* character pointer */
register BYTE n; /* number of bytes */
{
while (n--)
*cp++ = (char)getc(fp);
}